package cloud.cloud_web_service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Configuration
@EnableConfigurationProperties(DataSourceProperties.class)
@Controller
@EnableDiscoveryClient
@SpringBootApplication
public class WebServiceController  {
 
	@Autowired
	private DataSourceProperties dataSource;
	
    @ResponseBody
    @RequestMapping(value = "/")
    String home() {   
    	String url=dataSource.getUrl();
        return "Hello World!"+url;
    }
    
    @ResponseBody
    @RequestMapping(value = "/t1")
    String t1() {
    	String url=dataSource.getUsername();
        return "username:"+url;
    }
 
    public static void main(String[] args) throws Exception {
        SpringApplication.run(WebServiceController.class, args);
    }
 
}
